package com.wish.blessingroad.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wish.blessingroad.entity.User;
import com.wish.blessingroad.entity.returnBean.InviteUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author dhc
 * @since 2019-02-18
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("select user.id,user.name as userName,sum(blessing.fu_value) free from user"
                    + " JOIN blessing on `blessing`.user_id=`user`.id"
                    + " where `user`.recommend_id=#{id}"
                    + " GROUP BY blessing.user_id")
    public List<InviteUser> getUserFree(int id);
}
